# Maintainer: Maxime Gauduin <alucryd@archlinux.org>
# Contributor: cclin <cclinet@outlook.com>

pkgname=python-aiofiles
pkgver=23.1.0
pkgrel=2
pkgdesc='File support for asyncio'
arch=(any)
license=(APACHE)
url=https://github.com/Tinche/aiofiles
depends=(python)
makedepends=(
  git
  python-build
  python-installer
  python-poetry-core
)
checkdepends=(
  python-pytest-asyncio
  python-pytest
)
_tag=5cb9b6d3d51e0d9f8170cab06db8ae7f5792d8ff
source=(git+https://github.com/Tinche/aiofiles.git#tag=${_tag})
sha256sums=(SKIP)

pkgver() {
  cd aiofiles
  git describe --tags | sed 's/^v//'
}

build() {
  cd aiofiles
  python -m build --wheel --no-isolation
}

check() {
  local site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
  cd aiofiles
  python -m installer --destdir=test_dir dist/*.whl
  export PYTHONPATH="test_dir/$site_packages:$PYTHONPATH"
  pytest -vv
}

package() {
  python -m installer --destdir="${pkgdir}" aiofiles/dist/*.whl
  install -Dm 644 aiofiles/LICENSE -t "${pkgdir}"/usr/share/licenses/python-aiofiles/
}

# vim: ts=2 sw=2 et:
